<?php
namespace Vavilen\FirstBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class PostForm extends AbstractType
{
	public function buildForm(FormBuilderInterface $builder, array $options)
	{
		$builder->add('title');
		$builder->add('description');
		$builder->add('content');
		$builder->add('category', 'entity', array(
			'label'    => 'Category',
  			'class'    => 'VavilenFirstBundle:Category',
			'property' => 'categoryName',
		));
		$builder->add('tags', 'entity', array(
		    'label'    => 'Tag',
		    'multiple' => 'true',
		    'class'    => 'VavilenFirstBundle:Tag',
		    'property' => 'tagName',
		));
	}

	public function getName()
	{
		return 'post';
	}

	public function setDefaultOptions(OptionsResolverInterface $resolver)
	{
		$resolver->setDefaults(array(
		    'data_class' => 'Vavilen\FirstBundle\Entity\Post',
		));
	}
}